What is Class in HTML?

The class attribute allows us to apply the same style to multiple elements.

Syntax for Class

To define a class, use the class attribute inside an HTML element.

Example: <p class="classname"> Text Content </p>

Multiple Classes in One Element

An element can have multiple classes separated by space.

Web Development

Graphic Designing

Cyber Security

Same Class Used in Different Elements

Different elements can use the same class for consistent styling.

Artificial Intelligence

AI is revolutionizing the world with automation.

Using Class in JavaScript

Click the buttons below to change text color or hide elements.

This text will change color when you click the button.